const app = getApp();
Page({
    data: {
        curpage: 1,
        hasmore: true,
        page: 10,
        moreDetail: 'show',
        share_detail_list: []
    },
    onLoad: function (options) {
        var self = this;
        wx.getStorage({
            key: 'key',
            success: function (res) {
                self.setData({
                    key: res.data
                })
            }
        })
    },
    onReady: function () {
        this.shareDetail();
    },
    shareDetail: function () {
        var self = this;
        wx.request({
            url: app.globalData.ApiUrl + '/index.php?act=wx_share&op=memeber_share_detail',
            data: {
                key: self.data.key,
                page: self.data.page,
                curpage: self.data.curpage
            },
            method: 'GET',
            success: res => {
                if (res.data.code == 200) {
                    if (res.data.hasmore) {
                        self.data.curpage++
                    }
                    self.setData({
                        hasmore: res.data.hasmore,
                        share_detail_list: self.data.share_detail_list.concat(res.data.datas.share_detail_list)
                    })
                }
            }
        })
    },
    onReachBottom: function () {
        if (this.data.hasmore) {
            this.shareDetail()
        }
    },
})